mvn -Pall-tests clean install
The PicketLink Integration Test is a sub-project that provides some unit and integration tests to verify the reliability on major design items. You can clone this project from:
As PicketLink supports different containers, the tests need to run in each of them. The table bellow lists all the supported containers:
Container |
Version |
JBoss AS |
5.1.0.GA |
JBoss AS |
7.1.1.Final |
JBoss AS |
5.1.0.GA with JBossWS CXF Stack |
Apache Tomcat |
6.0.26 |
You must have the PicketLink Federation libraries installed in your maven local repository. Check which version is being used by the integration tests looking at the parent/pom.xml. There is a property named version.picketlink.
The PicketLink Quickstarts provides a lot of useful examples about how to use the PicketLink features. The applications provided by this project are used during the integration tests.
Before executing the tests, make sure you have the quickstarts installed in your maven local repository. The version must match the PicketLink libraries version.
Basically, the project is organized in two modules:
unit-test
Contains test classes and resources, only. For each feature there is a sub-module with specific tests and resources (Eg.: saml, ws-trust, etc).
util : Utility classes to be used by the test cases.
saml : SAML test cases.
ws-trust: WS-Trust test cases.
xacml : XACML test cases.
trust : PicketLink JAAS LoginModules test cases.
integration-tests
Contains all the configurations required to run the tests on a specific server. For each target container there is a sub-module (Eg.: jboss-as7, jboss-as5, tomcat-6, etc).
integration-webapps: Contains some applications used during the tests.
jboss-as5 : Configures a JBoss AS5 installation and execute the tests against it.
jboss-as5-cxf : Configures a JBoss AS5 installation with the JBossWS CXF Stack configured and execute the tests against it.
jboss-as6 : Configures a JBoss AS6 installation and execute the tests against it.
jboss-as7 : Configures a JBoss AS7 installation and execute the tests against it.
tomcat-6 : Configures a Apache Tomcat 6 installation and execute the tests against it.
In order to execute the tests, you need to use one of the configured Maven Profiles.
Profile |
Description |
all-tests |
Executes all test cases. |
saml-tests |
Executes only the SAML test cases. |
ws-trust-tests |
Executes only the WS-Trust test cases. |
xacml-tests |
Executes only the XACML test cases |
The example bellow shows how you can execute all tests:
mvn -Pall-tests clean install
mvn -Pws-trust-tests clean install
When you run one of the configured profiles, the default behaviour is to execute the tests against all the supported containers.
If you want to execute the tests in a specific container only, you can use the forceBinding parameter.
mvn -Pall-tests -DforceBinding=jbas5 clean verify
The example above will execute the tests only in JBoss AS 5.
As said before, each feature has its own module, which contains only the specific test cases for that feature.
The following sections will show how to create a SAML test case. The same rule apply for the WS-Trust, XACML, etc.
@TargetContainers ({"jbas5", "jbas6", "jbas7", "tomcat6"}) public class SAML2ExampleTestCase extends AbstractSAMLIntegrationTests { @Test public void testMethodExample() { // put your code here } @Deployment(name = "idp", testable = false) @TargetsContainer("jboss") public static WebArchive createIDPDeployment() throws ConfigurationException, ProcessingException, ParsingException, InterruptedException { WebArchive idp = MavenArtifactUtil.getQuickstartsMavenArchive("idp"); addTrustedDomain(idp, getServerAddress()); return idp; } @Deployment(name = "sales-post", testable = false) @TargetsContainer("jboss") public static WebArchive createSalesPostDeployment() { return MavenArtifactUtil.getQuickstartsMavenArchive("sales-post"); } }
As you can see, the class is using a @TargetContainers annotation. This annotation defines the containers in which the test should execute. In this case we are telling that we want to execute this test against all containers.
The integration tests uses Arquillian to start/stop the containers and deploy the testing applications. In the previous example, two applications will be deployed during the test execution: idp and sales-post. Both applications are provided by the PicketLink Quickstarts project, during the execution the war file is automatically retrieved from the maven repository.